From: Florian Müllner Date: Fri, 5 Jul 2019 16:10:56 +0000 (+0200) Subject: params: Fix regression X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~845^2^2~67 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8a5de327bb59850ad914dcceb683e275b577d83d;p=gnome-shell.git params: Fix regression The first parameter to Object.assign() is the same target object that will be returned. That is, since commit 46874eed0 Params.parse() modifies the @defaults object. Usually we pass that parameter as an object literal and this isn't an issue, but the change breaks spectacularly in the few cases where we use a re-usable variable. Restore the previous behavior by copying the object first. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/615 --- diff --git a/js/misc/params.js b/js/misc/params.js index 0e3af9532..6878395e9 100644 --- a/js/misc/params.js +++ b/js/misc/params.js @@ -1,5 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- +const Lang = imports.lang; + // parse: // @params: caller-provided parameter object, or %null // @defaults-provided defaults object @@ -21,5 +23,7 @@ function parse(params = {}, defaults, allowExtras) { throw new Error(`Unrecognized parameter "${prop}"`); } - return Object.assign(defaults, params); + let defaultsCopy = {}; + Lang.copyProperties(defaults, defaultsCopy); + return Object.assign(defaultsCopy, params); }